<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<title>登录页面</title>
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes" />
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

<link rel="stylesheet"
	href="<%=request.getContextPath()%>/assets/bootstrap-3.3.7-dist/css/bootstrap.min.css"
	type="text/css"></link>
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/assets/font-awesome-4.7.0/css/font-awesome.min.css"
	type="text/css"></link>

<style>
*{
	overflow:hidden;
}
.title span {
	color: green;
}
.b-r-none{
	 -webkit-border-radius: 0 !important;
     -moz-border-radius: 0 !important;
      border-radius: 0 !important;
}
</style>
</head>

<body>
	<div class="row">
		<div class="col-xs-10 col-md-4"
			style="margin-left:auto;margin-right:auto; display:block;float:none; margin-top:10%">
			<h3 class="title">
				<span><i class="fa fa-eye-slash"></i>&nbsp;</span>Blog System
			</h3>
			<from id="data" >
				<div class="form-group">
					<label >Account</label> <input type="text"
						class="form-control b-r-none" id="uname" name="uname" placeholder="Enter Email">
				</div>
				<div class="form-group">
					<label >Password</label> <input type="password"
						class="form-control b-r-none" id="upwd" name="upwd" placeholder="Enter Password">
				</div>
				<div class="form-group">
					<input id="loginBtn" class="btn btn-success btn-block b-r-none" type="button"
						value="Log In">
				</div>
			</from>
		</div>
	</div>

	<!-- Modal -->
	<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
		aria-labelledby="myModalLabel">
		<div class="modal-dialog" role="document">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-label="Close">
						<span aria-hidden="true">&times;</span>
					</button>
					<h4 class="modal-title" id="myModalLabel">Modal title</h4>
				</div>
				<div class="modal-body">...</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">确定</button>
				</div>
			</div>
		</div>
	</div>

	<script type="text/javascript"
		src="<%=request.getContextPath()%>/assets/js/jquery-3.2.1.min.js"></script>
	<script type="text/javascript"
		src="<%=request.getContextPath()%>/assets/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
	<script type="text/javascript">
		
		//ajax登录
		$("#loginBtn").click(function() {
			if($("#uname").val()==""){
				alert("帐号不能为空");
				return;
			}
			if($("#upwd").val()==""){
				alert("系统提示", "密码不能为空");
				return;
			}
			$.ajax({
				type : "post",
				url : "<%=request.getContextPath()%>/sys/login/validate",
				data : {"email":$("#uname").val(),"password":$("#upwd").val()},
				dataType : 'json',
				cache: false,
				success : function(data) {
					if (data.result == "success") {
						window.location.href="${pageContext.request.contextPath}/sys/index";
					} else {
						alert(data.result);
					}
				}
			});
		});

		
	</script>
</body>
</html>
